<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<#include "/jspgou_sys/head.html"/>
<script type="text/javascript">
$(function() {
	$("#jvForm").validate();
});
function addx(){
	var aa = $("#context").html();
	$("#cc").before(aa);
}
function dele(a){
	var b =$(a).parent();
	$(b).parent().remove();
	
}
</script>
</head>
<body>
<div class="body-box">
<div class="rhead">
	<div class="rpos"><@s.m "global.position"/>: <@s.m "shop.function.product"/> - <@s.m "product.function"/> - 属性</div>
	<form class="ropt">
		<input type="hidden" name="ctgId" value="${ctgId!}"/>
		<input type="submit" value="返回列表" onclick="this.form.action='v_list.do';"/>
	</form>
	<div class="clear"></div>
</div>

<form action="o_productExtUpdate.do" method="post">
<input type="hidden" name="ctgId" value="${ctgId!}"/>
<input type="hidden" name="productid" value="${product.id}"/>
<table width="100%" class="pn-ftable" cellpadding="2" cellspacing="1" border="0">
<tr><td class="pn-flabel pn-flabel-h" style="width: 15%;">属性：</td>
<td class="pn-fcontent"><input onclick="addx()" type="button" value="增加"></td></tr>
<#if product.productExt.productProperty??>
<#list product.productExt.propertysName as pname>
	<tr><td class="pn-flabel pn-flabel-h">${pname}:</td>
	<td class="pn-fcontent">
	<input type="hidden" name="pro_name" value="${pname}">
	<input type="text" name="pro_value" value="${product.productExt.propertysValue[pname_index]}">
	<a href="javascript:void(0);" onclick="dele(this)">删除</a>
	</td></tr>
</#list>
<#else>
<#list propertyList as property>
	<tr><td class="pn-flabel pn-flabel-h">${property.propertyName}:</td>
	<td class="pn-fcontent">
	<input type="hidden" name="pro_name" value="${property.propertyName}">
	<input type="text" name="pro_value">
	<a href="javascript:void(0);" onclick="dele(this)">删除</a>
	</td></tr>
</#list>
</#if>
<tr id="cc"><td class="pn-flabel pn-flabel-h">全方位图片：</td><td class="pn-fcontent"><input type="button" value="增加图片" onclick="addPicLine()"></td></tr>
<tr><td class="pn-flabel pn-flabel-h"></td><td class="pn-fcontent" id="pictures">
<#if product.productExt.productImgs??>
<#list product.productExt.imgs as img>
<table id="picTable${img_index}" border="0" style="float: left;">
<tr>
	<td>
		<div><input type="text" value="${img}" id="uploadImgPath${img_index}" name="picPaths"
					style="width: 160px" /> <a href="javascript:void(0);"
					onclick="$('#picTable${img_index}').remove();" class="pn-opt">删除</a></div>
		<div><span id="ufc${img_index}"><input type="file"
					id="uploadFile${img_index}" size="10" style="width: 150px" /></span> <input
					type="button" value="上传" onclick="upload(${img_index});"/></div>
		<div><textarea style="width:200px;height:60px;" name="picDescs" maxlength="255">${product.productExt.imgsDesc[img_index+1]}</textarea></div>
	</td>
	<td><img src="${uploadRoot}${img}" id="preImg{0}" alt="预览" noResize="true" style="overflow:hidden;width:90px;height:90px;background-color:#ccc;border:1px solid #333"/></td>
</tr>
</table>
</#list>
</#if>
<div id="picBefore" style="clear:both"></div>
</td></tr>
</table>
<input type="submit" onclick="return ff()" value="修改">
</form>




<textarea id="picTable" style="display: none;">
<table id="picTable{0}" border="0" style="float: left;">
<tr>
	<td>
		<div><input type="text" id="uploadImgPath{0}" name="picPaths"
					style="width: 160px" /> <a href="javascript:void(0);"
					onclick="$('#picTable{0}').remove();" class="pn-opt">删除</a></div>
		<div><span id="ufc{0}"><input type="file"
					id="uploadFile{0}" size="10" style="width: 150px" /></span> <input
					type="button" value="上传" onclick="upload({0});"/></div>
		<div>&lt;textarea style="width:200px;height:60px;" name="picDescs" maxlength="255"&gt;&lt;/textarea&gt;</div>
	</td>
	<td><img id="preImg{0}" alt="预览" noResize="true" style="overflow:hidden;width:90px;height:90px;background-color:#ccc;border:1px solid #333"/></td>
</tr>
</table>
</textarea>
<div id="context" style="display: none;">
<tr>
	<td class="pn-flabel pn-flabel-h""><input type="text"
		style="text-align: right;" name="pro_name"></td>
	<td class="pn-fcontent"><input type="text" name="pro_value"><a
		href="javascript:void(0);" onclick="dele(this)">删除</a></td>
</tr>
</div>

<#include "/common/image_upload.html"/>
</body>

<script type="text/javascript">
var picIndex = 0;
<#if product.productExt.productImgs??>
picIndex = ${product.productExt.imgs?size};
</#if>
	var picTpl = $.format($("#picTable").val());
	function addPicLine() {
		$('#picBefore').before(picTpl(picIndex++));
	}
</script>
</html>